ref="'.url("thread-$thread[tid]").'#'.$pid.'">'.lang('notice_lang_comment').''.lang('notice_message_replytoyou').'《'.$thread['subject'].'》
'.notice_substr($message, 40, FALSE).'
'; $recvuid = $thread['uid']; $recvuid != $quotepost['uid'] AND notice_send($uid, $recvuid, $notice_message, 2); //$quotepost['uid']可能是null,但不影响逻辑 // 引用 if(!empty($quotepid) && $quotepid > 0) { $notice_quote_message = '
'.lang('notice_lang_reply').''.lang('notice_message_replytoyou_at').'《'.$thread['subject'].'》'.lang('notice_message_replytoyou_for').'
'.notice_substr($quotepost['message'], 40, FALSE).'
'.notice_substr($message, 40, FALSE).'
'; notice_send($uid, $quotepost['uid'], $notice_quote_message, 2); } include _include(APP_PATH . 'plugin/xn_email_notice/model/email_notice.fun.php'); //获取帖子标题 $thread_msg=thread_read($tid); $thread_title=$thread_msg['subject']; $thread_uid=$thread_msg['uid'];//楼主uid //获取楼主用户名 $thread_user_msg=user_read($thread_uid); $user_name=$thread_user_msg['username']; $user_email=$thread_user_msg['email']; //获取回帖者用户名 $reply_user_msg=user_read($uid); $reply_nick=$reply_user_msg['username']; //回复内容 $reply_content=$message; //回复时间 $reply_time=date("Y年m月d日 H:i:s",$time); //帖子链接 $thread_url=$_SERVER['SERVER_NAME'].url("/thread-".$tid); //判断是否为引用 if($quotepid !=0){ $quotepost_msg=user_read($quotepost['uid']); $user_email=$quotepost_msg['email']; $user_name=$quotepost_msg['username']; } //获取配置信息 $email=kv_get('email_notice'); $fromname=$email['fromname']; $email_title=$email['email_title']; $email_message=$email["email_message"]; $email_user=$email['email']; $email_password=(string)$email['password']; $email_smtp=$email['smtp']; $email_port=$email['port']; //变量替换 $str=array('{thread_title}','{user_name}','{reply_nick}','{reply_content}','{reply_time}','{thread_url}'); $var=array($thread_title,$user_name,$reply_nick,$reply_content,$reply_time,$thread_url); $email_message=str_replace($str,$var,lang('send_posts_template_new')); $email_title=str_replace($str,$var,$email["email_title"]); $fromname=str_replace($str,$var,$email["fromname"]); $Tuser=user_read($uid); if($thread_user_msg['email_notice']){ sendEmail($user_email,$email_title,$email_message,$email_user,$email_password,$email_smtp,$email_port,$fromname); } $return_html = param('return_html', 0); $update_array = array(); if((($add_credit==1)||($add_credit==0&& $credits<0))&&$credits!=0) $update_array['credits+']=$credits; if((($add_credit==1)||($add_credit==0&& $golds<0))&&$golds!=0) $update_array['golds+']=$golds; if((($add_credit==1)||($add_credit==0&& $rmbs<0))&&$rmbs!=0) $update_array['rmbs+']=$rmbs; $uid AND $update_array AND user_update($uid, $update_array); $uid AND $update_array AND $user['gid']>=100 AND user_update_group($uid); $message = ''; isset($update_array['credits+']) AND $message .= lang('credits1').$credits_op.$credits.' ' ; isset($update_array['golds+']) AND $message .= lang('credits2').$golds_op.$golds.' ' ; isset($update_array['rmbs+']) AND $message .= lang('credits3').$rmbs_op.$rmbs ; if($return_html) { $filelist = array();ob_start(); include _include(APP_PATH.'view/htm/post_list.inc.htm'); $s = ob_get_clean();message(0, $s); } else { $message = $message ? $message : lang('create_post_sucessfully'); message(0, $message); } $return_html = param('return_html', 0); if($return_html) { $filelist = array(); ob_start(); include _include(APP_PATH.'view/htm/post_list.inc.htm'); $s = ob_get_clean(); message(0, $s); } else { message(0, lang('create_post_sucessfully')); } $message = param('message', '', FALSE); empty($message) AND message('message', lang('please_input_message')); $doctype = param('doctype', 0); xn_strlen($message) > 2028000 AND message('message', lang('message_too_long')); $thread['top'] > 0 AND thread_top_cache_delete(); $quotepid = param('quotepid', 0); $quotepost = post__read($quotepid); (!$quotepost || $quotepost['tid'] != $tid) AND $quotepid = 0; $post = array( 'tid'=>$tid, 'uid'=>$uid, 'create_date'=>$time, 'userip'=>$longip, 'isfirst'=>0, 'doctype'=>$doctype, 'quotepid'=>$quotepid, 'message'=>$message, ); $pid = post_create($post, $fid, $gid); empty($pid) AND message(-1, lang('create_post_failed')); // thread_top_create($fid, $tid); $post = post_read($pid); $post['floor'] = $thread['posts'] + 2; $postlist = array($post); $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $thread['subject'] = notice_substr($thread['subject'], 20); // 回复 $notice_message = '
'.lang('notice_lang_comment').''.lang('notice_message_replytoyou').'《'.$thread['subject'].'》
'.notice_substr($message, 40, FALSE).'
'; $recvuid = $thread['uid']; $recvuid != $quotepost['uid'] AND notice_send($uid, $recvuid, $notice_message, 2); //$quotepost['uid']可能是null,但不影响逻辑 // 引用 if(!empty($quotepid) && $quotepid > 0) { $notice_quote_message = '
'.lang('notice_lang_reply').''.lang('notice_message_replytoyou_at').'《'.$thread['subject'].'》'.lang('notice_message_replytoyou_for').'
'.notice_substr($quotepost['message'], 40, FALSE).'
'.notice_substr($message, 40, FALSE).'
'; notice_send($uid, $quotepost['uid'], $notice_quote_message, 2); } include _include(APP_PATH . 'plugin/xn_email_notice/model/email_notice.fun.php'); //获取帖子标题 $thread_msg=thread_read($tid); $thread_title=$thread_msg['subject']; $thread_uid=$thread_msg['uid'];//楼主uid //获取楼主用户名 $thread_user_msg=user_read($thread_uid); $user_name=$thread_user_msg['username']; $user_email=$thread_user_msg['email']; //获取回帖者用户名 $reply_user_msg=user_read($uid); $reply_nick=$reply_user_msg['username']; //回复内容 $reply_content=$message; //回复时间 $reply_time=date("Y年m月d日 H:i:s",$time); //帖子链接 $thread_url=$_SERVER['SERVER_NAME'].url("/thread-".$tid); //判断是否为引用 if($quotepid !=0){ $quotepost_msg=user_read($quotepost['uid']); $user_email=$quotepost_msg['email']; $user_name=$quotepost_msg['username']; } //获取配置信息 $email=kv_get('email_notice'); $fromname=$email['fromname']; $email_title=$email['email_title']; $email_message=$email["email_message"]; $email_user=$email['email']; $email_password=(string)$email['password']; $email_smtp=$email['smtp']; $email_port=$email['port']; //变量替换 $str=array('{thread_title}','{user_name}','{reply_nick}','{reply_content}','{reply_time}','{thread_url}'); $var=array($thread_title,$user_name,$reply_nick,$reply_content,$reply_time,$thread_url); $email_message=str_replace($str,$var,lang('send_posts_template_new')); $email_title=str_replace($str,$var,$email["email_title"]); $fromname=str_replace($str,$var,$email["fromname"]); $Tuser=user_read($uid); if($thread_user_msg['email_notice']){ sendEmail($user_email,$email_title,$email_message,$email_user,$email_password,$email_smtp,$email_port,$fromname); } $return_html = param('return_html', 0); $update_array = array(); if((($add_credit==1)||($add_credit==0&& $credits<0))&&$credits!=0) $update_array['credits+']=$credits; if((($add_credit==1)||($add_credit==0&& $golds<0))&&$golds!=0) $update_array['golds+']=$golds; if((($add_credit==1)||($add_credit==0&& $rmbs<0))&&$rmbs!=0) $update_array['rmbs+']=$rmbs; $uid AND $update_array AND user_update($uid, $update_array); $uid AND $update_array AND $user['gid']>=100 AND user_update_group($uid); $message = ''; isset($update_array['credits+']) AND $message .= lang('credits1').$credits_op.$credits.' ' ; isset($update_array['golds+']) AND $message .= lang('credits2').$golds_op.$golds.' ' ; isset($update_array['rmbs+']) AND $message .= lang('credits3').$rmbs_op.$rmbs ; if($return_html) { $filelist = array();ob_start(); include _include(APP_PATH.'view/htm/post_list.inc.htm'); $s = ob_get_clean();message(0, $s); } else { $message = $message ? $message : lang('create_post_sucessfully'); message(0, $message); } // 直接返回帖子的 html // return the html string to browser. $return_html = param('return_html', 0); if($return_html) { $filelist = array(); ob_start(); include _include(APP_PATH.'view/htm/post_list.inc.htm'); $s = ob_get_clean(); message(0, $s); } else { message(0, lang('create_post_sucessfully')); } } } elseif($action == 'update') { $pid = param(2); $post = post_read($pid); empty($post) AND message(-1, lang('post_not_exists')); $tid = $post['tid']; $thread = thread_read($tid); empty($thread) AND message(-1, lang('thread_not_exists')); $fid = $thread['fid']; $forum = forum_read($fid); empty($forum) AND message(-1, lang('forum_not_exists')); $isfirst = $post['isfirst']; !forum_access_user($fid, $gid, 'allowpost') AND message(-1, lang('user_group_insufficient_privilege')); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); !$allowupdate AND !$post['allowupdate'] AND message(-1, lang('have_no_privilege_to_update')); !$allowupdate AND $thread['closed'] AND message(-1, lang('thread_has_already_closed')); if($method == 'GET') { if($gid > 5 && isset($light_config['thread_user_upd']) && $light_config['thread_user_upd'] == 1) message(-1, lang('no_permission_update')); $forumlist_allowthread = forum_list_access_filter($forumlist, $gid, 'allowthread'); $forumarr = xn_json_encode(arrlist_key_values($forumlist_allowthread, 'fid', 'name')); // 如果为数据库减肥,则 message 可能会被设置为空。 // if lost weight for the database, set the message field empty. $post['message'] = htmlspecialchars($post['message'] ? $post['message'] : $post['message_fmt']); ($uid != $post['uid']) AND $post['message'] = xn_html_safe($post['message']); $attachlist = $imagelist = $filelist = array(); if($post['files']) { list($attachlist, $imagelist, $filelist) = attach_find_by_pid($pid); } $content_num = $thread['content_buy']; $content_type = $thread['content_buy_type']=='0'?'1': $thread['content_buy_type']; if($content_type == '3') $content_num = $content_num / 1; if($group['allowsell']=="1") { $input['content_num_status'] = form_radio_yes_no('content_num_status', $content_num > 0 ? 1 : 0); } $pnumber = $thread['readp']; $input['readp_status'] = form_radio_yes_no('readp_status', $pnumber > 0 ? 1 : 0); $isviponly = $thread['VIPonly']; $isviponlyA = $thread['VIPonlyA']; $input['VIPonly'] = form_radio_yes_no('VIPonly', $isviponly > 0 ? 1 : 0); $input['VIPonlyA'] = form_radio_yes_no('VIPonlyA', $isviponlyA > 0 ? 1 : 0); // 编辑器支持 HTML 编辑 if($post['doctype'] == 1) { $post['message'] = htmlspecialchars($post['message_fmt']); } include _include(APP_PATH.'view/htm/post.htm'); } elseif($method == 'POST') { $subject = htmlspecialchars(param('subject', '', FALSE)); $message = param('message', '', FALSE); $doctype = param('doctype', 0); $subject = trim(htmlspecialchars(param('subject', '', FALSE))); $inputmsg = str_replace(array("

","","

"),"",param('message', '', FALSE)); if( trim(str_replace(" ","",$inputmsg)) == "" ){ message('message', lang('please_input_message')); } if($isfirst) {empty($subject) AND message('subject', lang('please_input_subject'));} qt_check_sensitive_word($subject, 'post_sensitive_words', $qt_error) AND message('subject', lang('thread_contain_sensitive_word') . $qt_error); qt_check_sensitive_word($message, 'post_sensitive_words', $qt_error) AND message('message', lang('post_contain_sensitive_word') . $qt_error);include_once APP_PATH.'plugin/xn_geetest/model/geetest.fuc.php'; geetestcheck('geetest_edit_on');if($gid > 5 && isset($light_config['thread_user_upd']) && $light_config['thread_user_upd'] == 1) message(-1, lang('no_permission_update')); empty($message) AND message('message', lang('please_input_message')); mb_strlen($message, 'UTF-8') > 2048000 AND message('message', lang('message_too_long')); $arr = array(); if($isfirst) { $newfid = param('fid'); $forum = forum_read($newfid); empty($forum) AND message('fid', lang('forum_not_exists')); if($fid != $newfid) { !forum_access_user($fid, $gid, 'allowthread') AND message(-1, lang('user_group_insufficient_privilege')); $post['uid'] != $uid AND !forum_access_mod($fid, $gid, 'allowupdate') AND message(-1, lang('user_group_insufficient_privilege')); $arr['fid'] = $newfid; } if($subject != $thread['subject']) { mb_strlen($subject, 'UTF-8') > 80 AND message('subject', lang('subject_max_length', array('max'=>80))); $arr['subject'] = $subject; } $arr AND thread_update($tid, $arr) === FALSE AND message(-1, lang('update_thread_failed')); } $r = post_update($pid, array('doctype'=>$doctype, 'message'=>$message)); $r === FALSE AND message(-1, lang('update_post_failed')); $cjid = setting_get('cjid'); if($uid==$cjid){ $jp=param('jp'); $xnjp=param('xnjp'); $sj=param('sj'); $prizecount=param('prizecount'); $_r=db_find_one('thread',array('tid'=>$tid)); if($_r){db_update('thread',array('tid'=>$tid),array('jp'=>$jp,'sj'=>$sj,'xnjp'=>$xnjp,'prizecount'=>$prizecount));}} if (!isset($till_rss_setting)) { $till_rss_setting = setting_get('till_rss_setting'); } if ($isfirst && $till_rss_setting['update_on_thread_edit']) { if (!isset($forumlist_for_rss)) { $forumlist = forum_list_cache(); $forumlist_for_rss = forum_list_access_filter($forumlist, 0); } till_rss_generate_homepage($forumlist_for_rss, $till_rss_setting['rss_items'],$till_rss_setting['summary_length'],true); till_rss_generate_forums(array($forum), $till_rss_setting['rss_items'],$till_rss_setting['summary_length'],true); } global $group; if($isfirst) { $new_fid = param('fid'); $check_result = check_or_not($group, $new_fid, 'thread'); if($check_result)check_set_thread_check($tid,'0'); } else { $check_result = check_or_not($group, $fid, 'thread'); if($check_result)check_set_post_check($pid,'0'); } if($group['allowsell']=="1" && $isfirst) { $content_num_status = param('content_num_status'); $content_num = param('content_num'); if($content_num < 0 ){//判断购买主题货币值小于零 $content_num = 1;//小于零强制写为一 } $content_type = credits_get_content_type_by_name(param('content_type')); if($content_type == '3') $content_num = $content_num * 1; if ($content_num_status && $content_num) db_update('thread', array('tid' => $tid), array('content_buy' => $content_num, 'content_buy_type' => $content_type)); else db_update('thread', array('tid' => $tid), array('content_buy' => 0)); } $pnumber = param('readp'); $pstatus=param('readp_status'); if ($pstatus && $pnumber>=0) db_update('thread', array('tid' => $tid), array('readp' => $pnumber)); else db_update('thread', array('tid' => $tid), array('readp' => 0)); $isviponly = param('VIPonly'); if ($isviponly) db_update('thread', array('tid' => $tid), array('VIPonly' => 1)); else db_update('thread', array('tid' => $tid), array('VIPonly' => 0)); $isviponlyA = param('VIPonlyA'); if ($isviponlyA) db_update('thread', array('tid' => $tid), array('VIPonlyA' => 1)); else db_update('thread', array('tid' => $tid), array('VIPonlyA' => 0)); message(0, lang('update_successfully')); //message(0, array('pid'=>$pid, 'subject'=>$subject, 'message'=>$message)); } } elseif($action == 'delete') { $pid = param(2, 0); if($gid > 5 && isset($light_config['thread_user_del']) && $light_config['thread_user_del'] == 1) message(-1, lang('no_permission_delete')); if($method != 'POST') message(-1, lang('method_error')); $post = post_read($pid); empty($post) AND message(-1, lang('post_not_exists')); $tid = $post['tid']; $thread = thread_read($tid); empty($thread) AND message(-1, lang('thread_not_exists')); $fid = $thread['fid']; $forum = forum_read($fid); empty($forum) AND message(-1, lang('forum_not_exists')); $isfirst = $post['isfirst']; !forum_access_user($fid, $gid, 'allowpost') AND message(-1, lang('user_group_insufficient_privilege')); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); !$allowdelete AND !$post['allowdelete'] AND message(-1, lang('insufficient_delete_privilege')); !$allowdelete AND $thread['closed'] AND message(-1, lang('thread_has_already_closed')); $set_check = setting_get('tt_check'); if($set_check['recycle']=='1'){ if($isfirst) { if($thread['OK']=='-2' && $group['see_check']) thread_delete($tid); else recycle_thread_delete($tid); } else { post_delete($pid); //post_list_cache_delete($tid); } } else { if($isfirst) { thread_delete($tid); } else { post_delete($pid); //post_list_cache_delete($tid); } if (!isset($till_rss_setting)) { $till_rss_setting = setting_get('till_rss_setting'); } if ($isfirst && $till_rss_setting['update_on_thread_delete']) { if (!isset($forumlist_for_rss)) { $forumlist = forum_list_cache(); $forumlist_for_rss = forum_list_access_filter($forumlist, 0); } till_rss_generate_homepage($forumlist_for_rss, $till_rss_setting['rss_items'], $till_rss_setting['summary_length'], true); till_rss_generate_forums([$forum], $till_rss_setting['rss_items'], $till_rss_setting['summary_length'], true); } } message(0, lang('delete_successfully')); } elseif ($action == 'post_like') { $header['title'] = lang('haya_post_like')." - " . $conf['sitename']; if (!$uid) { message(0, lang('haya_post_like_login_like_tip')); } if ($method == 'POST') { $pid = param('pid'); $post = post_read($pid); empty($post) AND message(0, lang('post_not_exists')); if ($post['isfirst'] == 1) { if (isset($haya_post_like_config['open_thread']) && $haya_post_like_config['open_thread'] != 1 ) { message(0, lang('haya_post_like_close_thread_tip')); } } else { if (isset($haya_post_like_config['open_post']) && $haya_post_like_config['open_post'] != 1 ) { message(0, lang('haya_post_like_close_post_tip')); } } haya_post_like_cache_delete($post['tid']); $haya_post_like_check = haya_post_like_find_by_uid_and_pid($uid, $pid); $action2 = param(2, 'create'); if ($action2 == 'create') { if (!empty($haya_post_like_check)) { message(0, lang('haya_post_like_user_has_like_tip')); } haya_post_like_create(array( 'tid' => $post['tid'], 'pid' => $pid, 'uid' => $user['uid'], 'create_date' => time(), 'create_ip' => $longip, )); if (isset($haya_post_like_config['post_like_count_type']) && $haya_post_like_config['post_like_count_type'] == 1 ) { $haya_post_like_count = haya_post_like_count(array('pid' => $pid)); post__update($post['pid'], array('likes' => $haya_post_like_count)); if ($post['isfirst'] == 1) { thread__update($post['tid'], array('likes' => $haya_post_like_count)); } } else { $haya_post_like_count = intval($post['likes']) + 1; haya_post_like_loves($pid, 1); if ($post['isfirst'] == 1) { thread__update($post['tid'], array('likes+' => 1)); } } $haya_post_like_msg = array( 'count' => intval($haya_post_like_count), 'msg' => lang('haya_post_like_like_success_tip'), ); if (function_exists("notice_send")) { $notice_user = ' '.$user['username'].''; $thread = thread_read($post['tid']); $thread['subject'] = notice_substr($thread['subject'], 20); $notice_thread = '《'.$thread['subject'].'》'; $post['message'] = htmlspecialchars(strip_tags($post['message'])); $post['message'] = notice_substr($post['message'], 40); $notice_post = '【'.$post['message'].'】'; if ($post['isfirst'] == 1) { $notice_msg_tpl = lang('haya_post_like_send_notice_for_thread'); } else { $notice_msg_tpl = lang('haya_post_like_send_notice_for_post'); } $notice_msg = str_replace( array('{thread}', '{post}', '{user}'), array($notice_thread, $notice_post, $notice_user), $notice_msg_tpl ); notice_send($user['uid'], $post['uid'], $notice_msg, 150); } message(1, $haya_post_like_msg); } elseif ($action2 == 'delete') { if (isset($haya_post_like_config['like_is_delete']) && $haya_post_like_config['like_is_delete'] != 1 ) { message(0, lang('haya_post_like_no_unlike_tip')); } if (empty($haya_post_like_check)) { message(0, lang('haya_post_like_user_no_like_tip')); } $post_like = haya_post_like_read_by_uid_and_pid($uid, $pid); $delete_time = intval($haya_post_like_config['delete_time']); if ($post_like['create_date'] + $delete_time > time()) { message(0, lang('haya_post_like_no_fast_like_tip')); } haya_post_like_delete_by_pid_and_uid($pid, $user['uid']); if (isset($haya_post_like_config['post_like_count_type']) && $haya_post_like_config['post_like_count_type'] == 1 ) { $haya_post_like_count = haya_post_like_count(array('pid' => $pid)); post__update($post['pid'], array('likes' => $haya_post_like_count)); if ($post['isfirst'] == 1) { thread__update($post['tid'], array('likes' => $haya_post_like_count)); } } else { $haya_post_like_count = MAX(0, intval($post['likes']) - 1); haya_post_like_loves($pid, -1); if ($post['isfirst'] == 1) { $haya_post_like_thread = thread__read($post['tid']); if ($haya_post_like_thread['likes'] > 0) { thread__update($post['tid'], array('likes-' => 1)); } } } $haya_post_like_msg = array( 'count' => intval($haya_post_like_count), 'msg' => lang('haya_post_like_unlike_success_tip'), ); message(1, $haya_post_like_msg); } message(0, lang('haya_post_like_like_error_tip')); } message(0, lang('haya_post_like_like_error_tip')); } elseif($action=='check' && $method=='POST'){ $opt = param('opt');//1:OK -1:NO -2:DELETE $data = param('data'); $act = param('act'); if(!$uid){message(-1,'拉取信息失败!');die();} if($group['see_check']!=1){message(-1,'无权操作!');die();} if($act=='0') check_set_thread_check($data,$opt); elseif($act=='1') check_set_post_check($data,$opt); elseif($act=='2') check_set_user_check($data,$opt); message(0,'审核完毕!'); } elseif($action=='recycle' &&$method=='POST') { $set_recycle = setting_get('tt_check'); if($set_recycle['recycle']!='1') {message(-1,'未开启回收站功能!');die();} if($group['see_check']!='1') {message(-1,'无权操作回收站功能!');die();} $opt=param('opt'); $data=param('data'); //-1:recovery 1:delete if($opt=='-1') recycle_thread_recovery($data); elseif($opt=='1') recycle_thread_delete_true($data); message(0,'操作完毕!'); }elseif($action=='batchsh' &&$method=='POST') { $tid = param('tid');//1:OK -1:NO -2:DELETE $act = param('act'); if(!$uid){message(-1,'拉取信息失败!');die();} if($group['see_check']!=1){message(-1,'无权操作!');die();} batchupdate($tid,$act); message(0,'审核完毕!'); } ?>